package com.dazhi.show.story.tag.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

@Mapper
public interface TagMapper extends BaseMapper<Tag> {

    @Results({
            @Result(column = "id", property = "id"),
            @Result(column = "name", property = "name"),
            @Result(column = "name", property = "emperorList",
            many = @Many(select = "com.dazhi.show.story.emperor.dao.EmperorMapper.getByDynasty", fetchType = FetchType.EAGER))
    })
    @Select("SELECT id, name FROM tag")
    List<Tag> getTagAndEmperor();
}
